<?php
/*=============================================================================
|| ##################################################################
||	phpFoX Konsort
|| ##################################################################
||
||	Copyright		: (C) 2005-2007 PHPFOX Limited a Reality Fox Creation
||	Contact			: info@phpfox.com
||
||	- phpFoX and all of its source code and files are protected by Copyright Laws.
||
||	- The license for phpFoX permits you to install this software on a single domain (.com, .org, .net, etc.).
||
||	- You may also not remove this copyright screen which shows the copyright information and credits for phpFoX (RealityFOX Creations).
||
||	- phpFoX Konsort is NOT a FREE software - http://www.phpfox.com/license/
||
|| ##################################################################
=============================================================================*/

/* $File: ./include/classes/smarty/plugins/function.mp3player.php, $Author:  $ */

function smarty_function_mp3player($aParams)
{
    $iSongId = $aParams['id'];
    $sMode = $aParams['mode'];

    if (!$iSongId)
    {
        return '';
    }

    $sPlaylistUrl = str_replace(App::getParam('url'), '', App::makeUrl('public.music.playlist', array('id' => $iSongId, 'mode' => $sMode)));
    $sPlayerUrl = App::getParam('music.player.url');

	$iDisplayTotal = '182';
    if ( isset($aParams['total']) )
    {
    	switch($aParams['total'])
    	{
    		case 1:
			$iDisplayTotal = '91';
    		break;
    		case 2:
			$iDisplayTotal = '114';
    		break;
    		case 3:
			$iDisplayTotal = '138';
    		break;
    		case 4:
			$iDisplayTotal = '160';
    		break;
    	}
    }

	$sVariables = 'file='. $sPlaylistUrl .'';
 $sVariables = 'file='. $sPlaylistUrl .'';
 $sVariables .= '&thumbsinplaylist=false'; //Set to true if you want album thumbnails displayed
 $sVariables .= '&height=140'; // Sets player height
 $sVariables .= '&displaywidth=120'; // Sets album cover display width
 $sVariables .= '&displayheight=120'; // Sets album cover display width
 $sVariables .= '&largecontrols=false'; // Changes player controls larger
 $sVariables .= '&showeq=true'; // Shows a nice small equalizer
 $sVariables .= '&autoscroll=true'; // Auto scrolls playlist without the need of a scroll bar
 $sVariables .= '&repeat=list'; // This will advance song to the next in line
 $sVariables .= '&shuffle=false'; // This will play in order
 $sVariables .= '&autostart=false'; // Set to false if you do not want your player to auto start
 $sVariables .= '&backcolor=0xFFFFFF'; // Background color
 $sVariables .= '&frontcolor=0x333333'; //Front color
 $sVariables .= '&lightcolor=0xCC0000'; //Highlighted color
 $sVariables .= '&screencolor=0xCC0000'; // Player screen color

	$sPlayerCode = '<script type="text/javascript">EmbedVideo("'. App::getParam('music.player.url') .'?'. $sVariables .'", "420", "140", "'. $iDisplayTotal .'");</script>
	<noscript><div style="font-weight:bold; text-align:left; padding:2px;">'. App::format('Mod_Site.warning_no_javascript') .'</div></noscript>
	';

	return $sPlayerCode;
}
?>